home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QRZ! Ham Radio 4
/
QRZ Ham Radio Callsign Database - Volume 4.iso
/
files
/
amiga
/
nosutils.lha
/
SendMail.rx
< prev
Wrap
Text File
|
1993-12-05
|
3KB
|
134 lines
/* SendMail version 19931205 */
/* AREXX program to convert AmigaELM mail to AmigaNOS smtp compatible */
/* Edit the following two lines for your system */
/************************************************/
mailhost='n2mfc.ampr.org' /* name of mail host */
stationcall='n2mfc' /* station call sign */
/************************************************/
if ~show('L',"rexxsupport.library") then do
call addlib('rexxsupport.library',0,-30,0)
end
signal on BREAK_C
tz='GMT'
if open(timezone,'ENV:TZ','R') then do
tz=left(readln(timezone),3)
close(timezone)
end
ccflag=0
bccflag=0
open(mailout,'T:sendmail.tmp','W')
writeln(mailout,'Date: '||left(date('W'),3)||', '||date()||' '||time()||' '||tz)
hdrchk=1
do while ~eof(STDIN)
line=readln(STDIN)
if hdrchk then do
if upper(left(line,5))=='FROM ' then iterate
if upper(left(line,6))=='FROM: ' then do
if index(line,".txt")>0 then line=left(line,index(line,".txt")-1)||right(line,length(line)-index(line,".txt")-3)
end
if upper(left(line,9))=='SUBJECT: ' then hdrchk=0
if upper(left(line,4))=='CC: ' then do
parse var line cc cc.1 cc.2 cc.3 cc.4 cc.5 cc.6 cc.7 cc.8 cc.9 cc.10 .
if length(cc.1)>0 then ccflag=1
end
if upper(left(line,5))=='BCC: ' then do
parse var line bcc bcc.1 bcc.2 bcc.3 bcc.4 bcc.5 bcc.6 bcc.7 bcc.8 bcc.9 bcc.10 .
if length(bcc.1)>0 then bccflag=1
end
end
writeln(mailout,line)
end
close(mailout)
ccprocessing=0
bccprocessing=0
call Process
if ccflag then do
ccprocessing=1
do i=1 to 10 for 10
if length(cc.i)<1 then leave i
call open(mailin,file,'R')
call Process
end
ccprocessing=0
end
if bccflag then do
bccprocessing=1
do i=1 to 10 for 10
if length(bcc.i)<1 then leave i
call open(mailin,file,'R')
call Process
end
bccprocessing=0
end
call delete('T:sendmail.tmp')
exit 0
Process:
if ~open(seqfile,'TCPIP:spool/mqueue/sequence.seq','R') then do
say "***Can't open sequence.seq file, aborting!"
exit 20
end
seq=readln(seqfile)
seq=seq+1
close(seqfile)
open(seqfile,'TCPIP:spool/mqueue/sequence.seq','W')
writech(seqfile,seq)
close(seqfile)
open(mailout,'TCPIP:spool/mqueue/'||seq||'.txt','W')
open(mailwrk,'TCPIP:spool/mqueue/'||seq||'.wrk','W')
writeln(mailwrk,mailhost)
open(mailin,'T:sendmail.tmp','R')
hdrchk=1
do while ~eof(mailin)
line=readln(mailin)
if hdrchk then do
if upper(left(line,6))=='FROM: ' then do
writeln(mailwrk,substr(line,7,index(line," ",7)-7))
writeln(mailout,'Message-Id: <'||seq||'@'||stationcall||'.ampr.org>')
writech(stdout,"MsgId "||seq||": "||line||" ")
end
if upper(left(line,4))=='TO: ' then do
select
when ccprocessing then do
writeln(mailwrk,cc.i)
say 'Cc: '||cc.i
end
when bccprocessing then do
writeln(mailwrk,bcc.i)
say 'Bcc: '||bcc.i
end
otherwise
writeln(mailwrk,right(line,length(line)-4))
say line
end
close(mailwrk)
end
if upper(left(line,9))=='SUBJECT: ' then hdrchk=0
if upper(left(line,5))=='BCC: ' then iterate
end
writeln(mailout,line)
end
close(mailout)
close(mailin)
return
BREAK_C:
say "*** User break"
exit 10